<template>
	<view class="win-detail-contoiner">
		<view class="num">{{props.num}}</view>
		<view class="text">
			<view>{{props.dataItem.thingName}}</view>
			<view>申请人：{{applyName}}</view>
			<view>办理次数：
				<text class="numberText">{{props.dataItem.counts}}次</text>
			</view>
			<view>办理单位：{{props.dataItem.implementOrgan || '暂无'}}</view>
			<view v-for="item in list">第{{item.num}}次办理时间：{{item.time}}</view>
			<view>办理结果：
				<text class="resultText">{{resultList[props.dataItem.attendResult].name || '暂无'}}</text>
			</view>
		</view>
	</view>
</template>

<script setup>
import { computed } from 'vue'
const props = defineProps({
	dataItem: Array,
	num: Number,
})
const resultList = {
  0: { name: "不予批准", style: "result0" },
  1: { name: "批准", style: "result1" },
  2: { name: "转报", style: "result2" },
  3: { name: "终止办件", style: "result3" },
};
const list = computed(()=>{
	const arr = props.dataItem.timeArray?.split(',');
	if (arr) {
		const start = arr.length > 3 ? arr.length - 3 : 0;
		return arr.map((e,index)=>({num:index+1,time:e})).slice(start).reverse();
	} else {
		return [];
	}
})
const applyName = computed(()=>{
	if (props.dataItem.applyType == '个人') {
		return props.dataItem.applyName.substring(0,1) + '**'
	} else {
		return props.dataItem.applyName
	}
})
</script>

<style lang="scss" scoped>
	.win-detail-contoiner {
		display: flex;
		margin-top: 20rpx;
		border-bottom: 1rpx solid #F6F6F6;

		// align-items: center;
		.num {
			margin-top: 8rpx;
			padding: 0 5rpx;
			height: 34rpx;
			background: #455BDF;
			border-radius: 5rpx;
			line-height: 34rpx;
			text-align: center;
			font-size: 25rpx;
			font-family: Source Han Sans CN;
			font-weight: bold;
			color: #FFFFFF;
		}

		.text {
			margin-left: 20rpx;
			line-height: 50rpx;
			padding-bottom: 20rpx;
			font-size: 28rpx;
			.numberText{
				color: #455BDF;
			}
			.resultText{
				color: #FB453B;
			}
		}
	}

</style>
